package model

//用户表

type User struct {
	BaseModel
	Account  string `form:"account" json:"account" binding:"required" gorm:"size:30;not null;comment:登录账号"`
	Password string `form:"password" json:"password" gorm:"type:varchar(255) not null;comment:密码 sha1加密"`
	//Halt     string `form:"halt" json:"halt" gorm:"size:10;not null;comment:密码盐，混淆密码字符串"`
	Desc   string `form:"desc" json:"desc" gorm:"type:varchar(255);comment:描述"`
	Phone  string `form:"phone" json:"phone" gorm:"type:varchar(20) not null;unique;comment:手机号"`
	Email  string `form:"email" json:"email" gorm:"type:varchar(20) not null;comment:邮箱"`
	Avatar string `form:"avatar" json:"avatar" gorm:"type:varchar(255) not null;comment:头像/微信头像本地地址"`
	//Username string  			`form:"username" json:"username" gorm:"type:varchar(100);comment:昵称/微信昵称"`
	Nickname string `form:"nickname" json:"nickname" gorm:"type:varchar(100);comment:昵称/微信昵称"`
	Sex      uint   `form:"sex" json:"sex" gorm:"type:tinyint(1);default:0;comment:性别/微信性别 0 未知 1 男 2 女"`
	WxOpenid string `form:"wx_openid" json:"wx_openid" gorm:"unique;type:varchar(255) not null;comment:openid微信唯一标识"`
	Level    uint   `form:"level" json:"level" gorm:"type:tinyint(3);default:0;comment:会员等级 0 普通会员"`
	//积分
	//Integral      float64 `form:"integral" json:"integral" gorm:"type:decimal(10,2);default:0.00;comment:用户积分"`
	//UsedIntegral  float64 `form:"used_integral" json:"used_integral" gorm:"type:decimal(10,2);default:0.00;comment:已使用的积分"`
	//TotalIntegral float64 `form:"total_integral" json:"total_integral" gorm:"type:decimal(10,2);default:0.00;comment:总积分"`
	//积分 - 加密
	Integral      string `form:"integral" json:"integral" gorm:"type:varchar(128);default:0.00;comment:用户积分"`
	UsedIntegral  string `form:"used_integral" json:"used_integral" gorm:"type:varchar(128);default:0.00;comment:已使用的积分"`
	TotalIntegral string `form:"total_integral" json:"total_integral" gorm:"type:varchar(128);default:0.00;comment:总积分"`
	//分销
	IsRebate         uint   `form:"is_rebate" json:"is_rebate" gorm:"type:tinyint(1);default:0;comment:是否分销 0否 1 是 "`
	InviteCode       string `form:"invite_code" json:"invite_code" gorm:"unique;type:varchar(10);comment:自己的分销邀请码"`
	ParentInviteCode string `form:"parent_invite_code" json:"parent_invite_code" gorm:"type:varchar(10);comment:推荐人/第一父级的分销邀请码"`
	InviteLevel1     uint   `form:"invite_level1" json:"invite_level1" gorm:"default:0;comment:第一父级id /父级"`
	InviteLevel2     uint   `form:"invite_level2" json:"invite_level2" gorm:"default:0;comment:第二父级id /父级的父级"`
	InviteLevel3     uint   `form:"invite_level3" json:"invite_level3" gorm:"default:0;comment:第三父级id /父级的父级的父级"`
	OfflineNum       uint   `form:"offline_num" json:"offline_num" gorm:"default:0;comment:分销直线下线的人数"`
	//商城钱包
	//Wallet float64  			`form:"wallet" json:"wallet" gorm:"type:decimal(10,2);default:0.00;comment:商城钱包金额"`
	//WalletPassword string  		`form:"wallet_password" json:"wallet_password" gorm:"type:varchar(255) not null;default:1234,comment:钱包密码 sha1加密"`
	//UsedWallet float64  		`form:"used_wallet" json:"used_wallet" gorm:"type:decimal(10,2);default:0.00;comment:已使用的钱包金额"`
	//TotalWallet float64  		`form:"total_wallet" json:"total_wallet" gorm:"type:decimal(10,2);default:0.00;comment:总钱包金额"`
	//商城钱包 - 字符串，加码加密
	Wallet         string `form:"wallet" json:"wallet" gorm:"comment:商城钱包金额"`
	WalletPassword string `form:"wallet_password" json:"wallet_password" gorm:"type:varchar(128) not null;default:123456;comment:钱包密码 sha1加密"`
	UsedWallet     string `form:"used_wallet" json:"used_wallet" gorm:"comment:已使用的钱包金额"`
	TotalWallet    string `form:"total_wallet" json:"total_wallet" gorm:"comment:总钱包金额"`
	//公众号来源
	SubscribeScene string `form:"subscribe_scene" json:"subscribe_scene" gorm:"type:text;comment:用户来源 ADD_SCENE_SEARCH 公众号搜索，ADD_SCENE_ACCOUNT_MIGRATION 公众号迁移，ADD_SCENE_PROFILE_CARD 名片分享，ADD_SCENE_QR_CODE 扫描二维码，ADD_SCENEPROFILE LINK 图文页内名称点击，ADD_SCENE_PROFILE_ITEM 图文页右上角菜单，ADD_SCENE_PAID 支付后关注，ADD_SCENE_OTHERS 其他"`
	//小程序/公众号 永久二维码
	Ticket string `form:"ticket" json:"ticket" gorm:"type:text;comment:永久二维码ticket"`
	//登录token 移动到redis上
	//Token string `form:"token" json:"token" gorm:"comment:token用户唯一标识"`
}

// UserCreate 用户注册结构体
type UserCreate struct {
	BaseModel
	Account  string `form:"account" json:"account" binding:"required" _:"comment:登录账号"`
	Password string `form:"password" json:"password"  binding:"required"  _:"comment:密码 sha1加密"`
	Halt     string `form:"halt" json:"halt" _:"comment:密码盐，混淆密码字符串"`
	Desc     string `form:"desc" json:"desc" _:"comment:描述"`
	Phone    string `form:"phone" json:"phone" binding:"required,checkPhone"  _:"comment:手机号"`
	Email    string `form:"email" json:"email" binding:"checkEmail" _:"comment:邮箱"`
	Avatar   string `form:"avatar" json:"avatar" _:"comment:头像/微信头像本地地址"`
	//Username string  			`form:"username" json:"username" gorm:"type:varchar(100);comment:昵称/微信昵称"`
	Nickname string `form:"nickname" json:"nickname" gorm:"comment:昵称/微信昵称"`
}
